package com.hooya.fa.eu.biz.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.hooya.fa.eu.biz.dao.mapper.YearningOrderMapper;
import com.hooya.fa.eu.biz.service.YearningOrderService;
import com.hooya.integrated.common.entity.thirdpt.CoreSqlOrders;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description 1
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2024/6/19
 * @Version 1.0.0
 */
@Slf4j
@Service
@DS("yearning")
@RequiredArgsConstructor
public class YearningOrderServiceImpl implements YearningOrderService {

    private final YearningOrderMapper orderMapper;

    @Override
    public List<String> getOrderWorkIds() {
        List<CoreSqlOrders> orderList = orderMapper.getOrderWorkIds();
        if (CollectionUtils.isEmpty(orderList)) {
            return new ArrayList<>();
        }
        return orderList.stream().map(CoreSqlOrders::getWorkId).collect(Collectors.toList());
    }
}
